<template>
    <view class="record">
        <view v-if="historylist.length==0" class="page_dcenter_null">
            <img class="page_dcenter_null_img" src="../../../static/img_null_bookbuilding.png" />
            <view>暂无记录</view>
        </view>
        <scroll-view v-else scroll-y class="pagses">
            <view class="fm_top" v-for="(item, index) in historylist" :key="index">
                <div class="re_bo">
                    <div class="fm_top_ul">
                        <div class="fm_top_li">孕{{item.week}}周+{{item.day}}天</div>
                        <div
                            class="fm_top_li"
                            :class="item.bloodResult ==2?'':'red'"
                        >{{isbloodResult(item.bloodResult)}}</div>
                    </div>
                    <div class="fm_top_ul">
                        <div class="fm_top_li">
                            血压（mmHg）：
                            <span>{{item.systolicPressure}}</span>/
                            <span class="red"> {{item.diastolicPressure}}</span>
                        </div>
                        <div class="fm_top_li">{{item.beginTime}}</div>
                    </div>
                    <div class="fm_top_ul">
                        <div class="fm_top_li">心率(次/分)：<span  :class="item.pulsePateResult?'':'red'">{{item.pulsePate}}</span></div>
                        <div class="fm_top_li">{{item.collectionType==1?'手动录入':'设备测量'}}</div>
                    </div>
                </div>
                <div class="re_xian">
                    <div class="re_xian_img" @click="tips">
                        <img class="imgs" src="../../../static/icon_what.png" alt srcset />
                        <span>温馨提示</span>
                    </div>
                </div>
                <div class="record_imgsize">
                    <div
                        class="record_code"
                        v-for="(iteml, indexs) in item.gprojectsHistoryVOList"
                        :key="indexs"
                    >
                        <div class="record_code_img">
                            <img class="record_code_imgs" :src="iteml.imageUrlBlack" />
                           <!-- <img
                                class="record_code_imgs"
                                v-if="iteml.projectsValue"
                                :src="'../../../static/'+iteml.name+'1.png'"
                            />
                            <img
                                class="record_code_imgs"
                                v-else
                                :src="'../../../static/'+iteml.name+'.png'"
                            />-->
                        </div>

                        <div
                            class="record_sao"
                            :class="iteml.projectsValue?'':'shown'"
                        >{{iteml.name}}</div>
                        <div
                            class="record_sto"
                            :class="iteml.projectsValue?'':'shown'"
                        >{{iteml.projectsValue||''}}{{iteml.projectsValue?iteml.company:''}}</div>
                    </div>
                </div>
            </view>
            <div v-if="historylist.length>5" class="pagses_b">到底了~</div>
        </scroll-view>
    </view>
</template>
<script>
export default {
    data() {
        return {
            historylist: [],
            itemsList: [
                {
                    url: "../../../static/20.png",
                    urlN: "../../../static/20.png",
                    show: true,
                    name: "胰岛素",
                    value: "1u",
                },
                {
                    url: "../../../static/20.png",
                    urlN: "../../../static/20.png",
                    show: true,
                    name: "胰岛素",
                    value: "1u",
                },
                {
                    url: "../../../static/20.png",
                    urlN: "../../../static/20.png",
                    show: true,
                    name: "胰岛素",
                    value:
                        "1啊实打实阿达1啊实打实阿达1啊实打实阿达1啊实打实阿达",
                },
                {
                    url: "../../../static/20.png",
                    urlN: "../../../static/20.png",
                    show: true,
                    name: "胰岛素",
                    value: "1u",
                },
                {
                    url: "../../../static/20.png",
                    urlN: "../../../static/20.png",
                    show: true,
                    name: "胰岛素",
                    value: "1u",
                },
                {
                    url: "../../../static/20.png",
                    urlN: "../../../static/20.png",
                    show: true,
                    name: "胰岛素",
                    value: "1u",
                },
            ],
        };
    },
    // async onPullDownRefresh() {
    //     // to doing..
    //     this.lodingtop();
    //     // 停止下拉刷新
    // },
    mounted() {
        var _this = this;
        _this.getList();
    },
    methods: {
        goactive(itm) {},
        // lodingtop() {
        //     this.getList();
        //     uni.stopPullDownRefresh();
        // },
        isbloodResult(val) {
            var a = "";
            switch (val) {
                case 1:
                    a = "低压";
                    break;
                case 2:
                    a = "正常";
                    break;
                case 3:
                    a = "轻度偏高";
                    break;
                case 4:
                    a = "中度偏高";
                    break;
                case 5:
                    a = "重度偏高";
                    break;
                default:
                    a = "";
            }
            return a;
        },
        getperiod(val) {
            var a = "";
            switch (val) {
                case 0:
                    a = "早餐前";
                    break;
                case 1:
                    a = "早餐后";
                    break;
                case 2:
                    a = "午餐前";
                    break;
                case 3:
                    a = "午餐后";
                    break;
                case 4:
                    a = "晚餐前";
                    break;
                case 5:
                    a = "晚餐后";
                    break;
                case 6:
                    a = "睡前";
                    break;
                case 7:
                    a = "凌晨";
                    break;
                default:
                    a = "";
            }
            return a;
        },
        getList() {
            const data = {
                monitorTypeId: "316189802716475392",
                pageNum: 1,
                pageSize: 10000,
            };
            // 【移动端】获取用户监测历史记录（血糖）316189802716475392
            // 316189802716475392
            var _this = this;
            _this.$ajaxs
                .get("/mobile/v1/monitor/getSugarAndPressure", data)
                .then((res) => {
                    if (res.status == 200) {
                        _this.historylist = res.content.list;
                    } else {
                        uni.showToast({
                            title: "请检查网络~",
                            icon: "none",
                        });
                    }
                })
                .catch((err) => reject(err));
        },
        tips() {
            uni.showModal({
                title: "温馨提示提示",
                cancelText: " ",
                showCancel:false,
                confirmText: "我知道了",
                confirmColor: "#FA4D93",
                content:
                    "血压异常时，请关注测量前3小时的用药及生活方式记录，找到原因，以后注意。",
                success(res) {
                    if (res.confirm) {
                    } else if (res.cancel) {
                    }
                },
            });
        },
    },
};
</script>

<style scoped lang="scss">
.record {
    height: calc(100% - 88upx);
    .red {
        color: #fa4d93;
    }
    .page_dcenter_null {
        padding-top: 180upx;
        text-align: center;
        .page_dcenter_null_img {
            height: 180upx;
            width: 162upx;
        }
        div {
            color: #999;
            font-size: 28upx;
            height: 40upx;
            line-height: 40upx;
        }
    }
    .pagses {
        height: 100%;
        .fm_top {
            margin-top: 30upx;
            background: #fff;
            .re_bo {
                border-left: 16upx solid #fa4d93;
                padding: 20upx 40upx 20upx 24upx;
            }
            .fm_top_ul {
                display: -webkit-box;
                display: -webkit-flex;
                display: flex;
                .fm_top_li {
                    -webkit-box-flex: 1;
                    -ms-flex: 1;
                    flex: 1;
                    align-items: center;
                    justify-content: center;
                    vertical-align: middle;
                    height: 65upx;
                    line-height: 65upx;
                }
                .fm_top_li:nth-of-type(2) {
                    text-align: right;
                }
            }
            .re_xian {
                position: relative;
                border-top: 1px solid #ddd;
                .re_xian_img {
                    position: absolute;
                    right: 0;
                    top: -20upx;
                    background: #fff;
                    color: #333;
                    font-size: 20upx;
                    padding-right: 40upx;
                    .imgs {
                        width: 25upx;
                        height: 25upx;
                        margin-right: 5upx;
                        vertical-align: middle;
                    }
                    span {
                        vertical-align: middle;
                    }
                }
            }
            .record_imgsize {
                display: -webkit-box;
                display: -webkit-flex;
                display: flex;
                text-align: center;
                padding: 20upx 90upx;
                .record_code {
                    -webkit-box-flex: 1;
                    -ms-flex: 1;
                    flex: 1;
                    width: 16.6%;
                    align-items: center;
                    justify-content: center;
                    vertical-align: middle;
                    .record_code_img {
                        color: #666;
                        .record_code_imgs {
                            width: 45upx;
                            height: 45upx;
                            vertical-align: middle;
                        }
                    }
                    .shown {
                        color: #999;
                    }
                    .record_sao {
                        height: 34upx;
                        line-height: 34upx;
                    }
                    .record_sto {
                        width: 100%;
                        height: 34upx;
                        font-size: 24upx;
                        line-height: 34upx;
                        overflow: hidden;
                        text-overflow: ellipsis;
                        white-space: nowrap;
                    }
                }
            }
        }
        .pagses_b {
            text-align: center;
            font-size: 24upx;
        }
    }
}
</style>